<?php

namespace app\home\controllers;

class Index
{
    public function index()
    {
        $user_id = session('user_id');
        $user  = model('user')->find($user_id);

        $data = [
            'page_title'  => '主页',
            'user'        => $user,
            'custom_js'   => [
                'gifffer.js',
            ],
        ];

        // 使用公共模板
        template('public', $data);
    }

    public function demo()
    {
        view('home/demo');
        // template('public');
    }
}